package com.aceitunaproject.server;


import com.aceitunaproject.server.combat.CombatSystem;
import com.aceitunaproject.server.combat.CombatSystemImpl;
import com.aceitunaproject.server.equipment.EquipmentManager;
import com.aceitunaproject.server.equipment.EquipmentManagerImpl;
import com.aceitunaproject.server.installation.InstallationManagerImpl;
import com.aceitunaproject.server.installation.InstallationTypeManager;
import com.aceitunaproject.server.installation.InstallationTypeManagerImpl;
import com.aceitunaproject.server.installation.InstallationManager;
import com.aceitunaproject.server.map.MapManager;
import com.aceitunaproject.server.map.MapManagerImpl;
import com.aceitunaproject.server.materialgoods.MaterialGoodManager;
import com.aceitunaproject.server.materialgoods.MaterialGoodManagerImpl;
import com.aceitunaproject.server.message.DefaultMessageHandler;
import com.aceitunaproject.server.message.MessageHandler;
import com.aceitunaproject.server.permissions.PermissionManager;
import com.aceitunaproject.server.permissions.PermissionManagerImpl;
import com.aceitunaproject.server.player.PlayerManager;
import com.aceitunaproject.server.player.PlayerManagerImpl;
import com.aceitunaproject.server.science.ScientificAdvanceManager;
import com.aceitunaproject.server.science.ScientificAdvanceManagerImpl;
import com.aceitunaproject.server.settlement.SettlementManager;
import com.aceitunaproject.server.settlement.SettlementManagerImpl;
import com.aceitunaproject.server.time.tick.TickManager;
import com.aceitunaproject.server.time.tick.TickManagerImpl;
import com.aceitunaproject.server.unit.UnitManager;
import com.aceitunaproject.server.unit.UnitManagerImpl;
import com.sun.sgs.app.AppContext;
import com.sun.sgs.app.DataManager;

/**
 * This class provides managers for all  game actions
 * 
 * @author Federico Bergstein
 *
 */
public class AceitunaContext {
	
	

	
	public static void initializeManagers()
	{

		DataManager dataManager  = AppContext.getDataManager();
		dataManager.setBinding("TickManager", new TickManagerImpl());
		dataManager.setBinding("MapManager", new MapManagerImpl());
		dataManager.setBinding("UnitManager", new UnitManagerImpl());
	}
	
	/**
	 * @return the mapManager
	 */
	public static MapManager getMapManager() {
		return (MapManager)AppContext.getDataManager().getBinding("MapManager");
		
	}
	/**
	 * @return the playerManager
	 */
	public static PlayerManager getPlayerManager() {
		return new PlayerManagerImpl();
	}
	/**
	 * @return the unitManager
	 */
	public static UnitManager getUnitManager() {
		return (UnitManager)AppContext.getDataManager().getBinding("UnitManager");
	}

	public static TickManager getTickManager() {
		
		return (TickManager)AppContext.getDataManager().getBinding("TickManager");
	}
	
	public static PermissionManager getPermissionManager()
	{
		return new PermissionManagerImpl();
	}
	
	public static SettlementManager getSettlementManager()
	{
		return new SettlementManagerImpl();
	}
	
	public static EquipmentManager getEquipmentManager()
	{
		return new EquipmentManagerImpl();
	}
	
	public static ScientificAdvanceManager getScientificAdvanceManager()
	{
		return new ScientificAdvanceManagerImpl();
	}

	public static InstallationTypeManager getInstallationTypeManager() {
		
		return new InstallationTypeManagerImpl();
	}

	public static InstallationManager getInstallationManager() {
	
		return new InstallationManagerImpl();
	}

	public static MaterialGoodManager getMaterialGoodsManager() {
		
		return new MaterialGoodManagerImpl();
	}
	
	public static MessageHandler getMessageHandler()
	{
		return new DefaultMessageHandler();
	}
	
	public static CombatSystem getCombatSystem()
	{
		return new CombatSystemImpl();
	}
}

